import * as businessApi from '@/api/hmmm/companys'

const state = {
  // 企业管理列表
  businessList: [],
  // 编辑框数据
  editList: {}
}

const mutations = {
  SET_BUSINESS_LIST (state, newValue) {
    state.businessList = newValue
  },
  SET_EDIT_LIST (state, newValue) {
    state.editList = newValue
  }
}

const actions = {
  async updateBusinessList ({ commit }) {
    const res = await businessApi.companys()
    commit('SET_BUSINESS_LIST', res)
  },
  async updateEditList ({ commit }, data) {
    const res = await businessApi.edit(data)
    commit('SET_EDIT_LIST', res)
  }
}

export default {
  namespaced: true,
  state,
  mutations,
  actions
}
